Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Deployment Version to the Flow Run object #12591

Merged
merged 11 commits into from
Apr 9, 2024

Conversation

masonmenges
Copy link
Contributor

@masonmenges masonmenges commented Apr 4, 2024

This PR adds the deployment version to flow run objects for better traceability/lineage in determining which version of code ran when a flow run was triggered.

Example

@flow
async def demo_flow(date: datetime = None):
    logger = get_run_logger()
    context = get_run_context()    
    flow_run_id = context.flow_run.id
    deployment_id = context.flow_run.deployment_id

    async with get_client() as client:
        dep = await client.read_deployment(deployment_id)
        flow_run = await client.read_flow_run(flow_run_id)
        logger.info("deployment version from Deployment: " + dep.version)
        logger.info("Deployment version from Flow Run: " + flow_run.deployment_version)

Checklist

  • This pull request references any related issue by including "closes <link to issue>"
    • If no issue exists and your change is not a small fix, please create an issue first.
  • This pull request includes tests or only affects documentation.
  • This pull request includes a label categorizing the change e.g. maintenance, fix, feature, enhancement, docs.

closes #11983

@masonmenges masonmenges added the enhancement An improvement of an existing feature label Apr 4, 2024
Copy link

netlify bot commented Apr 4, 2024

Deploy Preview for prefect-docs-preview ready!

Name Link
🔨 Latest commit 4d0ed19
🔍 Latest deploy log https://app.netlify.com/sites/prefect-docs-preview/deploys/660ef084d41cd90008180d8a
😎 Deploy Preview https://deploy-preview-12591--prefect-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@masonmenges masonmenges marked this pull request as ready for review April 4, 2024 18:44
@masonmenges masonmenges requested review from a team and zangell44 as code owners April 4, 2024 18:44
@masonmenges masonmenges merged commit fe07861 into main Apr 9, 2024
43 of 53 checks passed
@masonmenges masonmenges deleted the deployment_version_flow_runs branch April 9, 2024 14:26
@@ -619,6 +619,7 @@ async def _generate_scheduled_flow_runs(
"id": uuid4(),
"flow_id": deployment.flow_id,
"deployment_id": deployment_id,
"deplyment_version": deployment.version,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deplyment_version is this an issue?

Copy link
Contributor Author

@masonmenges masonmenges Apr 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meggers

deplyment_version is this an issue?

It shouldn't be no, but for clarification are you just referring to the naming convention?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for my lack of clarity, was referring to the misspelling (missing o in deployment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yep thanks for flagging that I'll get it updated 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Associate deployment versions with flow runs
3 participants